home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
oocs
/
frmserve.frm
< prev
next >
Wrap
Text File
|
1999-09-06
|
3KB
|
120 lines
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form frmServer
BorderStyle = 4 'Fixed ToolWindow
Caption = "Server"
ClientHeight = 570
ClientLeft = 8010
ClientTop = 5190
ClientWidth = 4680
Icon = "frmServer.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 570
ScaleWidth = 4680
ShowInTaskbar = 0 'False
Begin VB.CommandButton cmdExit
Caption = "&Exit"
Height = 375
Left = 3720
TabIndex = 0
Top = 120
Width = 855
End
Begin MSWinsockLib.Winsock tcpServer
Left = 4080
Top = 2160
_ExtentX = 741
_ExtentY = 741
_Version = 393216
End
Begin VB.Label lblCReq
BorderStyle = 1 'Fixed Single
Height = 255
Left = 120
TabIndex = 1
Top = 160
Width = 3495
End
End
Attribute VB_Name = "frmServer"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private WithEvents RemoteServer As cServerActions
Attribute RemoteServer.VB_VarHelpID = -1
Private Sub RemoteServer_ConnectionClosed()
Form_Load ' reload the form
Set RemoteServer = Nothing
Set Server_ = Nothing
End Sub
Private Sub RemoteServer_RequestedID(Accepted As Boolean)
If Accepted Then
'Set the connection variable
bInConnection = True
SendData "Accepted,"
StatusReport "Connection Made"
Exit Sub
End If
' notify client there was a connection error
SendData "Request_Error, There was an error with the RequestID"
End Sub
Private Sub tcpServer_Close()
Server_.Closed tcpServer
StatusReport "Connection Terminated"
End Sub
Private Sub tcpServer_ConnectionRequest(ByVal requestID As Long)
If bInConnection Then Exit Sub 'if connected continue, don't accept
' re create and reference the objects, since they were
' destroyed earlier when the connection was terminated
Set Server_ = New cServerActions
Set RemoteServer = Server_
' send in the connection request
Server_.ConnectReq requestID, tcpServer
End Sub
Private Sub tcpServer_DataArrival(ByVal bytesTotal As Long)
Dim sIncoming As String
tcpServer.GetData sIncoming
'--- send the data to be evaluated
Server_.HandleIncomingData sIncoming, tcpServer, frmServer
End Sub
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub Form_Load()
On Error GoTo GetOut
Server_.InitTCP 333, tcpServer ' initialze winsock to listen
bInConnection = False
GetOut:
Exit Sub
End Sub